﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace OpSatPlan.LexerParser
{
    public class ProblemProcessor
    {
        private string mProblemFileName;
        private Domain mDomain;

        public ProblemProcessor(string probFileName, Domain domain)
        {
            this.mProblemFileName = probFileName;
            this.mDomain = domain;
        }

        public Problem BuildProblem()
        {
            Problem problem;
            PddlLexer lexer;
            ProblemParser problemParser;
            TUVienna.CS_CUP.Runtime.Symbol root;

            // build problem
            lexer = new PddlLexer(new System.IO.StreamReader(this.mProblemFileName));
            problemParser = new ProblemParser(lexer);
            root = problemParser.parse();
            problem = ((ProblemNode)root.value).BuildProblem(this.mDomain);
            return problem;
        }
    }
}
